﻿Imports Microsoft.Reporting.WinForms
Imports System.Windows.Forms
Public Class relProposta

    Public Property DatRelatorio As DataTable
    Public Property Cotacao As String
    Public Property Cliente As String
    Public Property DataProposta As Date
    Public Property DataValidade As Date
    Public Property Solicitacao As String
    Public Property Consulta As String
    Public Property CondicoesComerciais As String
    Public Property Observacoes As String


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try

            'Variavel para alimentar o dataSource do report
            Dim rds As ReportDataSource = New ReportDataSource()

            'Alimenta dataSource
            rds.Value = Me.DatRelatorio
            rds.Name = "datProduto"

            'Informa ao Report que ele utilizar 
            Me.rptRelatorio.LocalReport.DataSources.Add(rds)


            'Carrega Parâmetros
            Dim parametros As New List(Of ReportParameter)()

            parametros.Add(New ReportParameter("Cotacao", "243241"))
            parametros.Add(New ReportParameter("Cliente", Me.Cliente))
            parametros.Add(New ReportParameter("DataProposta", Me.DataProposta))
            parametros.Add(New ReportParameter("DataValidade", Me.DataValidade))
            parametros.Add(New ReportParameter("Solicitacao", Me.Solicitacao))
            parametros.Add(New ReportParameter("Consulta", Me.Consulta))
            parametros.Add(New ReportParameter("CondicoesComerciais", ""))
            parametros.Add(New ReportParameter("Observacoes", Me.Observacoes))

            rptRelatorio.LocalReport.SetParameters(parametros)

            'Carrega Relatorio
            Me.rptRelatorio.RefreshReport()

        Catch ex As Exception
            MessageBox.Show("Ocorreu um erro ao gerar o Relatório de Atendimento. Verifique com o setor de T.I.", _
                                "Courier - Módulo de Circulação.", _
                                MessageBoxButtons.OK, _
                                MessageBoxIcon.Information)
        End Try
    End Sub

End Class
